import React, { useEffect, useState } from 'react';
import './index.scss'
import { Button,Table,Form,Input } from 'antd';
import service from '../../../../api'
// import { useNavigate } from 'react-router-dom'
import axios from 'axios';

const Brand = () => {

    var [data, setData] = useState([])
    // var navigate = useNavigate()

    useEffect(() => {
        getbrandlist()
    }, [])
    var getbrandlist = async ()=>{
        var res = await axios({
            url:"http://localhost:3001/brand"
        })
        setData(res.data)
    }




    const columns = [
        {
            title: '品牌名称',
            dataIndex: 'name',
            key: 'name',
            
        },
        {
            title: '排序',
            dataIndex: 'sorting',
            key: 'sorting',
            render: (text: any, record: any, index: any) => <div>{record.sorting}</div>,
        },
        {
            title: '创建时间',
            dataIndex: 'time',
            key: 'time',
            render: (text: any, record: any, index: any) => <div>{record.time}</div>,
        },
        {
            title: '操作',
            dataIndex: 'exit',
            key: 'exit',
            render: (text: any, record: any, index: any) => <div className='exit'><span>编辑</span><span>删除</span></div>,
        },
        
    ]



    return (
        <div>
            <div className='top'>
                <Button  type="primary" className='button'>新建品牌</Button>
            </div>
            <div className='bottom'>
                <Table columns={columns} dataSource={data} />
            </div>
        </div>
    );
};

export default Brand;